#pragma once
#include <unordered_map>
#include <iostream>
#include <string>
#include <fstream>

const std::string sep = ":"; // 分隔符
const std::string dictname = "./ContentType.txt";

class Init
{
public:
    Init()
    {
        std::fstream ss(dictname);
        if (!ss.is_open() )
        {
            std::cerr << "fstream error" << std::endl;
        }
        std::string line;
        while(std::getline(ss,line))
        {
            auto pos=line.find(sep);
            if(pos==std::string::npos)
                continue;
            contenttype_.insert({line.substr(0,pos),line.substr(pos+1)});
        }

        // for(auto &e:contenttype_)
        // {
        //     cout<<e.first<<":"<<e.second<<endl;
        // }
    }

public:
    std::unordered_map<std::string, std::string> contenttype_; // 维护content的类型
};